<template>
  <el-dialog
			title="个人评论"
			:visible.sync="pinglunShow"
			width="700px"
      @close="show"
      :modal="false">
      <div class="elTime" v-loading="loading" v-if="dataList.length != 0">
        <el-timeline>
          <el-timeline-item v-for="(item,index) in dataList" :key="index" :timestamp="item.ctime" placement="top">
            <el-card>
              <h4 style="cursor: pointer;" @click="golookNews(item.aid)">{{item.aid.aname}}</h4>
              <p>{{item.content}}</p>
            </el-card>
          </el-timeline-item>
        </el-timeline>
      </div>
      <div v-else class="NoelTime">
        暂无评论信息
      </div>
			<span slot="footer" class="dialog-footer">
				<el-button @click="show">取 消</el-button>
				<el-button type="primary" @click="show">确 定</el-button>
			</span>
		</el-dialog>
</template>
<script>
export default {
  props:{
    pinglunShow:{
      type:Boolean,
      default:false
    }
  },
  watch:{
    pinglunShow(){
      if(!this.pinglunShow) return
      this.loading = true
      this.$http.post('/artcate/user_content',{uid:this.$userInfo._id}).then(res => {
        if(res.status == 0){
          this.dataList = res.message
        }else{
          this.$message({
            message: res.message,
            type: 'error'
          });
        }
        this.loading = false
      })
    }
  },
  data() {
    return {
      loading:true,
      dataList:[]
    }
  },
  methods:{
    show(){
      this.$emit('closedialogpinglun')
    },
    golookNews(item){
			window.open('/client/lookNews?aid=' + item._id)
		},
  }
}
</script>
<style scoped>
.elTime{
  max-height: 400px;
  overflow-y: auto;
}
.NoelTime{
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #9195a3;
}
</style>